<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>定时器练习</title>
</head>
<body>
    <div>
        <img id="img" src="../../img/off.gif" >
    </div>
</body>
<script type="text/javascript">
	var x = 0;
	window.setInterval(function() {
		if(x==0){
            document.getElementById("img").innerHTML='<img id="img" src="../../img/on.gif" />';
			x = 1;
		}else{
			document.getElementById("img").innerHTML='<img id="img" src="../../img/off.gif" />';
			x = 0;
		}
	},1000);
	
	
</script>
</html>